/*
The Heterogeneous Welfare Impacts of Tax Audits
This metafile produces the main figures
*/

* Paper or Slides formatting 
global version paper

* Personal file path inputs 
*Location of Replication Package
global mvpf_audits "C:/Users/sethuo/Dropbox (MIT)/MVPF-Tax-Audits/Paper/Replication/Replication_Package" 

if "${version}"=="paper" global graphpath "${mvpf_audits}/Figures/${version}" 
if "${version}"=="slides" global graphpath "${mvpf_audits}/Figures/${version}"


* years to keep
global min_yr = 2010
global max_yr = 2014
global multiplier_yr = 2003 // base year for projection and discounting

* GS payscale step
global step = 5

* Income definition
global inc = "tpi" // Takes values "agi" and "tpi"

*formatting 
global tc = "gs4"
global rc_col= "128 67 128" // tasteful eggplant

* Set color scheme (high contrast use for plots with many series)
set scheme opp_insights_fb

/*------------------------------------------------------------------------------
Figure: Waterfall chart showing average cost and revenue per audit
------------------------------------------------------------------------------*/
do "${mvpf_audits}/code/analysis/waterfall_cost_rev_future_disc.do"		1	 // 1 = ops, 2 = corr, 3 = both

/*------------------------------------------------------------------------------
Figures: Scatter plots showing R/C by income (with alt. overhead allocations)
------------------------------------------------------------------------------*/				
do "${mvpf_audits}/code/analysis/scatter_cost_rev_rc_inc.do"	1	// 1 = ops, 2 = corr, 3 = both	

do "${mvpf_audits}/code/analysis/scatter_alt_oh_allocations.do" ops // ops or corr

do "${mvpf_audits}/code/analysis/scatter_rev_costs_corr.do"					
/*------------------------------------------------------------------------------
Figure: Connected plot showing audit prob, total revenues, and audit wage costs
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/line_rc_audit_prob.do" nrp	// takes values ops, nrp, both

/*------------------------------------------------------------------------------
Figure: Scatter R and R/C in 2014 against values in 2010, by income
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/rc_45_degree.do"	

/*------------------------------------------------------------------------------
Figures: Change in audit expenditures and rates by TPI bins
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/bar_roc.do"

/*------------------------------------------------------------------------------
Figure: Event studies of taxes paid each year post-audit
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/event_study_taxes_paid.do"	// baseline
do "${mvpf_audits}/code/analysis/event_study_taxes_paid_2yr_groups.do"	// 2-3 year groups
do "${mvpf_audits}/code/analysis/event_study_taxes_paid_4yr_groups.do"	// 4 year groups
do "${mvpf_audits}/code/analysis/event_study_taxes_paid_bus_income.do"	// business income
do "${mvpf_audits}/code/analysis/event_study_taxes_paid_ops.do"	// dd

/*------------------------------------------------------------------------------
Figures: Coeffplot deterrence multipliers 
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/coeffplot_deterrence.do"	
do "${mvpf_audits}/code/analysis/coeffplot_deterrence_plus_rev.do"	

/*------------------------------------------------------------------------------
Figures: Waterfall chart of MVPF construction (20-30th and 90-99th percentiles)
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/waterfall_mvpf.do"	

/*------------------------------------------------------------------------------
Figures: Scatter plot of MVPF estimates by income
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/scatter_mvpf.do"		

/*------------------------------------------------------------------------------
Appendix Figure: Cumulative Share of Revenue Collected and Labor Costs Accrued
------------------------------------------------------------------------------*/
do "${mvpf_audits}/code/analysis/cum_rev_shares_inc_w99.do"	

/*------------------------------------------------------------------------------
Appendix Figure: Average Hours and Auditor Wage Rate, by Income
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/scatter_labor_hours_inc"	

/*------------------------------------------------------------------------------
Appendix Figure: Average Costs, Revenue and Revenue over Costs, by Year
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/scatter_cost_rev_rc_year"	

/*------------------------------------------------------------------------------
Appendix Figure: Average Costs and Revenue per NRP audit, by Income and Year
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/scatter_cost_rev_rc_inc_year_nrp"	

/*------------------------------------------------------------------------------
Appendix Figure: Audit rates, Costs, and Revenues per Correspondence audit, by Income
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/connected_corr_inc"	

/*------------------------------------------------------------------------------
Appendix Figure: In-Person R/C Using Corrected TPI (10% and 20% Tax)
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/scatter_rc_inc_corr"	

/*------------------------------------------------------------------------------
Appendix Figure: Taxpayer Burden of Audits
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/scatter_burden.do"	

/*------------------------------------------------------------------------------
Appendix Figure: No Change Rate
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/no_change_costs.do"	

/*------------------------------------------------------------------------------
Appendix Figure: EITC
------------------------------------------------------------------------------*/	
do "${mvpf_audits}/code/analysis/coeffplot_eitc.do"
